<?php
include_once("../configs/admin.config.inc.php");	//--> admin global var
include_once("db.inc.php");							//--> db global var
include_once("Smarty.class.php");					//--> out template
include_once("Operation.php");						//--> Operation
include_once("PicUpload.php");						//--> PicUpload
include_once("Pic.php");							//--> Pic
include_once("InfoClass.php");						//--> InfoClass
require_once("controlHeader.php");					//--> system control header
include_once("Strings.php");						//--> String

$objOperate		= new Operation($objSession->session['lan']);			//--> Operation
$objPicUpload	= new PicUpload($objSession->session['lan'], $uid);		//--> PicUpload
$objPic			= new Pic($objSession->session['lan'], $uid);			//--> Pic
$objString  	= new Strings();										//--> String
$objInfoClass	= new InfoClass($objSession->session['lan'], $uid);	//--> InfoClass

$error_message = '';

if(isset($_GET['id']))
	$picid = $_GET['id'];
	
$arrOperate 	= $objOperate->arrGetFromGroupIDAndMenuID($gid, $menuid);
$arrOperateInfo = $objOperate->arrGetOPInfo($arrOperate);

$arrDataList = $objPicUpload->lists($arrOperate, " WHERE picid=$picid", $page, DISPLAY_DATA_SIZE, '');
if(is_array($arrDataList)){
	foreach($arrDataList as $key=>$value){
		$arrDataInfo = $objInfoClass->getFromID($arrOperate, $value['formatid']);
		$arrDataList[$key]['name'] = $value['picid'].'.'.$arrDataInfo['name'];
		
		$arrDataInfo = $objPic->getFromID($arrOperate, $value['picid']);
		$arrDataList[$key]['picName'] 	= $arrDataInfo['name'];
		$arrDataList[$key]['fileSize']  = $value['fileSize']/1000;
	}
}

/*----- out html -----*/
$smarty = new Smarty();		//----- out template
$smarty->template_dir = TEMPLATE_DIR;
$smarty->compile_dir  = COMPILE_DIR;

$smarty->assign('error_message', $error_message);
$smarty->assign('menuGid', $menuGid);
$smarty->assign('menuid', $menuid);
$smarty->assign('backurl',$backurl);

$smarty->assign('selfFileName', $objOperate->strGetSelfFileName());
$smarty->assign('arrOperateInfo', $arrOperateInfo);

$smarty->assign('picid', $picid);

$smarty->assign('arrDataList', $arrDataList);
$smarty->assign('PAGE_BAR', $objBookUpload->pagenav);

$smarty->display('listPicUpload.htm');
?>
